package com.google.code.ptrends.common.utils;

import java.util.Locale;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;

public class Row {

	public Row() {
		body = new Properties();
	}

	public void addValue(String columnName, String value) {
		if (StringUtils.isBlank(columnName))
			throw new IllegalArgumentException(
					"Illegal null or empty column name");

		body.setProperty(columnName.toUpperCase(Locale.ENGLISH), value);
	}

	public String getValue(String columnName) {
		return body.getProperty(columnName.toUpperCase(Locale.ENGLISH));
	}

	public int getInt(String columnName) {
		String stringValue = body.getProperty(columnName
				.toUpperCase(Locale.ENGLISH));
		return Integer.parseInt(stringValue);
	}

	Properties body;
}
